<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="js/jquery.min.js"></script>
</head>

<body>
  <div>
    <a href="#">1</a>
    <a href="#">2</a>
    <a href="#">3</a>
  </div>
  <ul>
    <li><a href="#">a</a></li>
    <li><a href="#">b</a></li>
    <li><a href="#">c</a></li>
  </ul>
  <script>
    $("div a").click(function () {
      console.log($(this).index());
    })
    $("ul a").click(function () {
      console.log($(this).index());
    })
  </script>
</body>

</html>